tuple1 = (12, 34, 56)
tuple2 = ('abc', 'mn')
# tuple1[0] = 100
# tuple1[0] =200

tuple3 = tuple1 + tuple2
print(tuple3)

n = input('请输入姓名：')
t = input('请输入电话：')
e = input('请输入邮箱地址：')
a = input('请输入联系地址:')
tuple1 = ("姓名：", n, "电话:", t, "邮箱地址：", e, "联系地址:", a)

list1 = [1, "hello", 2, "C语言"]
print(list1)
print(type(list1))

list2 = []
print(list2)

# list1 =list("hello")
# print(list1)

# print(list())

l3 = list("hello")
print(13)

t1 = tuple("hello")
t4 = list(t1)
print(14)

r1 = range(5)  # 0,1,2,3,4
print(r1)
l5 = list(r1)
print(l5)

# 访问列表中的元素
l1 = [1, 2, 3, '8', 'p', 'U']
# 使用正数索引进行访问，访问p
print(l1[4])
# 使用负向索引进行访问p
print(l1[-2])

# # 使用切片访问元素的格式：代码如下：
# list1 = ['p','y','t','h','o','n']
# # 使用正数切片，截取索引为2,3，的元素，默认步长为1
# print(list1[2:5])
# print(list1[:3])
# print(list1[3:])
# print(list1[1:6:2])
# print(list1[-3:-1])

# print(list[::-1])

l2 = ['p', 'u', 'w', 'r', 1, 5, 7]

print(l2[2:5])

print(l2[:3])

print(l2[4:])

print(l2[1:6:2])

print(l2[-6:-3])

print(l2[::-1])
l3 = [10, 8, 6, 5, 2, 1]
print(l3[::-1])

# #遍历
# list1 =['Python',java','c']
# #for
# for item in list1:
#     print(item)
l3 = ['1', '2', '3', '4']
for i in l3:
    print(i)
# # 修改列表
# # 修改单个
l4 = [10, 56, 34, 2, 56, 44, 7]

l4[2] = 100
print(l4)
#
# #修改多个
l5 = [10, 56, 34, 2, 56, 44, 7]
# #修改1-4
l5[1:4] = [45, -56, 98]
print(l5)

l6 = ['a', 'b', 'c']
l6.append('f')
l6.append(l6)

l6.append(['e', 'f'])
print(l6)

l7 = ['a', 'b', 'c']
l7.extend('d')
print(17)

l7.extend('world')
print(l7)

l8 = ['python', 'c', 'java']

l8.insert(2, 'go')

print(l8)

# # 删除元素
l15 = ['a', 'b', 'c', 'd']
l15.remove('a')
print(l15)

l16 = [10, 56, 34, 0, 2, 7]
l16.pop(3)
print(l16)
# 删除最后一个元素
l16.pop()
print(l16)
#
l17 = ['a','b','c','d','e']
# 删除索引为1的元素
del l17[1]
print(l17)
l18 = [10,56,34,2,58,44,7]
# 删除索引为1-3的元素
del l18[1:4]
print(l18)
# 若将列表中所有元素全部删除，可使用列表的clear（）方法
l19 = ['a','b','c','a']
# 清空列表
l19.clear()
print(l19)


name_list = []
phone_list = []
while 1:
    print("菜单：1.添加联系人 2.修改联系人 3.删除联系人")
    chioce = input("请输入选择")

    if chioce == "1":
        name_list.append(input("请输入联系人姓名："))
        phone_list.append(input("请输入联系人手机号："))
        print(name_list)
        print(phone_list)

    elif chioce == "2":
        num =int(input("请输入联系人编号："))
        if len(name_list) > 0 and num <= len(name_list):
            name_list[num - 1] = input("修改联系人姓名")
            phone_list[num - 1] = input("修改联系电话")
        else:
            print("联系人编号输入有误")

    elif chioce == "3":
        num = int(input("请输入联系人编号："))
        if len(name_list) > 0 and num <= len(name_list):
            name_list.pop(num-1)
            phone_list.pop(num - 1)
        else:
            print("联系人编号输入有误")
    else:
        print("显示联系人信息")
        print(name_list)
        print(phone_list)